<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('已单向选择学生列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table"></table>
		</div>
	</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
	var sexData = [[${@dict.getType('sys_user_sex')}]];
	var prefix = ctx + "system/tutor";
	$(function() {
		var options = {
			url: prefix + "/stuList",
			showSearch: false,
			showRefresh: false,
			showToggle: false,
			showColumns: false,
			pagination: false,
			columns: [
				{
					checkbox: true
				},
				{
					field: 'stuSno',
					title: '学号'
				},
				{
					field: 'sysUser.userName',
					title: '姓名'
				},
				{
					field: 'sysUser.sex',
					title: '性别',
					formatter: function (value, row, index) {
						return $.table.selectDictLabel(sexData, value);
					}
				},
				{
					field: 'sysUser.phonenumber',
					title: '电话'
				},
				{
					field: 'intention1',
					title: '选择意向'
				},
				{
					field: 'intention2',
					title: '选择意向'
				}
			]
		};
		$.table.init(options);
	});
	/* 添加用户-选择用户-提交 */
	function submitHandler() {
		var count =    [[${count}]];
		var titleCount =    [[${titleCount}]];
		var rows = $.table.selectFirstColumns();
		if (rows.length == 0) {
			$.modal.alertWarning("请至少选择一条记录");
			return;
		}else if(rows.length > titleCount-count){
			var c=titleCount-count;
			$.modal.alert("你最多可选择"+c+"条记录");
			return;
		}
		var data = {};
		data["stuSno"]=rows.join();
		$.operate.post(ctx+ "system/tutor/editTea", data);
	}
</script>
</body>
</html>